<!DOCTYPE html>
<html>
    <head>
        {% if config.get('GOOGLE_SITE_VERIFICATION', None) %}
            <meta name="google-site-verification" content="{{ config['GOOGLE_SITE_VERIFICATION'] }}" />
        {% endif %}
        <meta charset=utf-8 />
        <meta name="robots" content="noindex" />
        {{ newrelic_head()|safe }}
        <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}?{{ version|slugify }}" />
        <title>
            {{ title }}{% if title != config.get('SITE_NAME') %} | {{ config.get('SITE_NAME') }}{% endif %}
        </title>
        <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}?{{ version|slugify }}" type="text/css">
        <link rel="stylesheet" href="{{ url_for('static', filename='bigscreen.css') }}?{{ version|slugify }}" type="text/css">
        <link rel="stylesheet" href="{{ url_for('static', filename='css/font-awesome.min.css') }}?{{ version|slugify }}">

        {% if config.get('LOGGR_KEY', None) %}
            {% set loggr_key = config['LOGGR_KEY'] %}
            <script src="https://api.loggr.net/1/loggr.min.js?l=kardboard&amp;a={{ loggr_key }}"></script>
        {% else %}
            {% set loggr_key = '' %}
        {% endif %}

        <script src="{{ url_for('static', filename='jquery.min.js') }}?{{ version|slugify }}" type="text/javascript"></script>
        <script src="{{ url_for('static', filename='jquery-ui-1.10.0.custom.min.js') }}?{{ version|slugify }}" type="text/javascript"></script>
        <script src="{{ url_for('static', filename='sortables.js') }}?{{ version|slugify }}" type="text/javascript"></script>
        <script src="{{ url_for('static', filename='bigscreen.js') }}?{{ version|slugify }}" type="text/javascript"></script>
        <script src="{{ url_for('static', filename='highcharts.js') }}?{{ version|slugify }}" type="text/javascript"></script>
        {% block extrajs %}
        {% endblock %}
    </head>
    <body>
        {% if config.get('TICKET_AUTH', False) %}
            <p class="auth nav">
                {% if 'username' in session %}
                    Hi {{ session['username'] }}! | <a href="{{ url_for('logout') }}">Logout</a>
                    {% if loggr_key %}
                    <script type="text/javascript">
                        var username = "{{ session['username'] }}";
                        var emailAddress = "";
                        Loggr.Log.trackUser(username, emailAddress);
                    </script>
                    {% endif %}
                {% else %}
                    <a href="{{ url_for('login', next=request.path) }}">Login</a>
                {% endif %}
            </p>
        {% endif %}

        <h1>{% block title %}{{ title }}{% endblock title %}</h1>

        <div class="nav">
            <a href="/">Dashboard</a>&nbsp;/&nbsp;
            <a href="/reports/">Reports</a>&nbsp;/&nbsp;
            <a href="/card/add/">Add a card</a>&nbsp;&nbsp;|&nbsp;

            <form action="/quick/" method="GET">
                <label for="search">Search:</label>
                <input type="text" name="key" id="search" />
                <input type="submit" value="Go" name="go" />
            </form>
        </div>

        {% block content %}{% endblock content %}

        <p class="updated">Updated at {{ updated_at }}</p>
        <p class="version">kardboard {{ version }}</p>

        <a href="https://github.com/cmheisel/kardboard" class="forkme">
            <img src="{{ url_for('static', filename='forkme.png') }}" alt="Fork me on GitHub" />
        </a>

        {% if config.get('GOOGLE_ANALYTICS', '') %}
        <script type="text/javascript">
            var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
            document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
        </script>
        <script type="text/javascript">
        try{
            var pageTracker = _gat._getTracker("{{ config['GOOGLE_ANALYTICS'] }}");
            pageTracker._trackPageview();
        } catch(err) {}
        </script>
        {% endif %}
        {{ newrelic_foot()|safe }}
    </body>
</html>
